﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WorkSpace.Core;

namespace WorkSpace.Web
{
    /// <summary>
    /// Summary description for WorkSpaceLoadIconHandler
    /// </summary>
    public class WorkSpaceLoadIconHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            Guid id = new Guid(context.Request.QueryString["id"]);
            IWorkSpaceService service = new WorkSpaceService();
            IconData icon = service.FindIcon(id);
            context.Response.ContentType = "image/png";
            context.Response.BinaryWrite(icon.Data);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}